<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<form id="pagerForm" method="get" model="viewRequest" action="${rootUrl}/goods/goods-sku/${goodsSku.id}/edit">
</form>
<div class="pageContent">
	<form method="post" action="${rootUrl}/goods/goods-sku<c:if test="${goodsSku.id != 0 && goodsSku.id != '' }">/${goodsSku.id}</c:if>" class="pageForm required-validate" onsubmit="return beforeSub(this)">
		<c:if test="${goodsSku.id != 0 && goodsSku.id != '' }"><input type="hidden" name="_method" value="put"></c:if>
		<input type="hidden" name="goodsSku.id" value="${goodsSku.id }">
		<input type="hidden" name="goodsSku.version" value="${goodsSku.version }">
		<input type="hidden" name="goodsSku.goods.id" value="${goodsSku.goods.id }">
		<input type="hidden" id="goodsSkuState" name="goodsSku.state" value="${goodsSku.state }">
		<div class="pageFormContent" layoutH="56">
			<c:if test="${goodsSku.state == 2}"><h3 style="color: red;line-height: 30px;width: 100%;background-color: #ccc;">该sku已经封存，不能修改</h3></c:if>
			<c:forEach items="${goodsSpecValues}" var="specValue" varStatus="status">
				
				<p>
				<label>${specValue.goodsSpec.specClassName }：</label>
				
				<input name="goodsSpecValues[${status.index}].specName" readonly="readonly" type="text" size="30" value="${specValue.specName}" />
				<input name="goodsSpecValues[${status.index}].id" type="hidden" size="30" value="${specValue.id}" />
				<input name="goodsSpecValues[${status.index}].goodsSpec.specClassName" type="hidden" size="30" value="${specValue.goodsSpec.specClassName }" />
				<input name="goodsSpecValues[${status.index}].goodsSpec.id" type="hidden" size="30" value="${specValue.goodsSpec.id }" />
				<input name="goodsSpecValues[${status.index}].goodsSpec.specClass.id" type="hidden" size="30" value="${specValue.goodsSpec.specClass.id }" />
				<input name="goodsSpecValues[${status.index}].goodsSpec.specClass.name" type="hidden" size="30" value="${specValue.goodsSpec.specClass.name }" />
				<%-- <input type="hidden" name="goods.goodsClass.id" value="${goods.goodsClass.id }"> --%>
				<a class="btnLook" href="${rootUrl}/goods/goods-spec-value/0/dialog?goodsSpecId=${specValue.goodsSpec.id}" lookupGroup="goodsSpecValues[${status.index}]">类别</a>
			</p>
			</c:forEach>
			<p>
				<label>子标题：</label>
				<input name="goodsSku.subTitle" type="text" size="30" value="${goodsSku.subTitle }" />
			</p>
			<p style="width: 440px;">
				<label>库存：</label>
				<input class="listMoneyField" name="goodsSku.inventory" class="required digits" <c:if test="${goodsSku.id != 0 && goodsSku.id != '' }"> readonly="readonly"</c:if> type="text" size="30" value="${goodsSku.inventory }" />
				<c:if test="${goodsSku.id != 0 && goodsSku.id != '' && goodsSku.state != 2}">
				<a style="line-height: 22px;margin-left: 4px;" title="库存维护" target="dialog" rel="inventoryflow_edit" href="${rootUrl}/goods/goods-sku/${goodsSku.id}/toInventoryFlow">库存维护</a>
				</c:if>
			</p>
			<p style="width: 440px;">
				<label>重量(克)：</label>
				<input class="listMoneyField" name="goodsSku.weight" class="required number" type="text" size="30" value="${goodsSku.weight }" />
			</p>
			<%-- <p style="width: 440px;">
				<label>状态：</label>
				<select id="selGoodsSkuState">
					<option <c:if test="${goodsSku.state == 1}">selected="selected"</c:if> value="1">正常</option>
					<option <c:if test="${goodsSku.state == 0}">selected="selected"</c:if> value="0">下架</option>
				</select>
			</p> --%>
			<p style="width: 440px;">
				<label>状态：</label><c:if test="${goodsSku.state == 0}">下架</c:if><c:if test="${goodsSku.state%10== 1}">正常</c:if><c:if test="${goodsSku.state%10== 3}">赠品</c:if><c:if test="${goodsSku.state-10>0}">待审核</c:if>
			</p>
			<p style="width: 440px;">
				<label>是否下架 ：</label>
				<input id="chkGoodsSkuState" <c:if test="${goodsSku.state == 0}">checked="checked"</c:if> type="checkbox" name="isLock" value="1">是
			</p>
			<c:if test="${goodsSku.state == 3 || goodsSku.goods.state == 3}">
				<p id="txtGoodsSkuPoints">
					<label>所需积分数 ：</label>
					<input class="listMoneyField" name="goodsSku.points" class="required number" type="text" size="30" value="${goodsSku.points }" />
				</p>
			</c:if>
   		 </div>
    	<div class="formBar">
			<ul>
				<c:if test="${goodsSku.state != 2}">
					<li><div class="buttonActive"><div class="buttonContent"><button id="theSubmit" type="submit">保存</button></div></div></li>
				</c:if>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
    </form>
    	
</div>
<script>
	function beforeSub(obj){
		var state = $("#selGoodsSkuState").val();
		if(state == 1 && $('#chkGoodsSkuState').is(':checked')){
			state = 3;
		}
		$("#goodsSkuState").val(state);
		return validateCallback(obj, newDialogAjaxDone);
	}
	 /* $("#chkGoodsSkuState").change(function() {
		 if($('#chkGoodsSkuState').is(':checked')){
			 $("#txtGoodsSkuPoints").css("display","block");
		 }else{
			 $("#txtGoodsSkuPoints").css("display","none");
		 }
	 });
	 $("#chkGoodsSkuState").trigger("change"); */
</script>